package cc.yugu.yhdw.common.domain.basic;


import cc.yugu.yhdw.common.domain.IntIdEntity;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * 推送详细内容实体类
 * 
 * @Date:Created in 2018/7/25 14:19
 * @Author:
 * @Modified By: zjn 2018/7/25 14:19
 */ 
public class PushMessage extends IntIdEntity {
    protected Integer sendStatus; //推送状态
    protected Integer sourceType; //推送类型
    protected String sourceId; //来源ID
    protected Integer resendNum; //发送次数
    protected Date handleTime; //发送时间
    protected Date createTime; //创建时间

    public enum SourceType {
        BALANCE_PAY(1, "订单付款成功", "订单支付", "您的账户发生一笔%s元支出"),
        BESPEAK_EXCHANGE_ORDER(2, "预约订单成功", "预约订单", "预约订单成功"),
        BATTERY_CAPACITY_INSUFFICIENT(3, "电池电量不足提示", "电池电量不足", "您的电池电量已不足10%,请及时更换"),
        ;

        private final int value;
        private final String name;
        private final String title;
        private final String description;


        private SourceType(int value, String name, String title, String description) {
            this.value = value;
            this.name = name;
            this.title = title;
            this.description = description;
        }

        private static Map<Integer, SourceType> map = new HashMap<Integer, SourceType>();

        static {
            for (SourceType e : SourceType.values()) {
                map.put(e.getValue(), e);
            }
        }

        public static SourceType getSourceType(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

        public String getTitle() {
            return title;
        }

        public String getDescription() {
            return description;
        }
        }

    public enum MessageStatus {
        NOT(1, "未发"),
        OK(2, "成功"),
        FAIL(3, "失败"),;

        private final int value;
        private final String name;

        private MessageStatus(int value, String name) {
            this.value = value;
            this.name = name;
        }

        private static Map<Integer, String> map = new HashMap<Integer, String>();

        static {
            for (MessageStatus e : MessageStatus.values()) {
                map.put(e.getValue(), e.getName());
            }
        }

        public static String getName(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public Integer getSendStatus() {
        return sendStatus;
    }

    public void setSendStatus(Integer sendStatus) {
        this.sendStatus = sendStatus;
    }

    public Integer getSourceType() {
        return sourceType;
    }

    public void setSourceType(Integer sourceType) {
        this.sourceType = sourceType;
    }

    public String getSourceId() {
        return sourceId;
    }

    public void setSourceId(String sourceId) {
        this.sourceId = sourceId;
    }

    public Integer getResendNum() {
        return resendNum;
    }

    public void setResendNum(Integer resendNum) {
        this.resendNum = resendNum;
    }

    public Date getHandleTime() {
        return handleTime;
    }

    public void setHandleTime(Date handleTime) {
        this.handleTime = handleTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "PushMessage{" +
                "sendStatus=" + sendStatus +
                ", sourceType=" + sourceType +
                ", sourceId='" + sourceId + '\'' +
                ", resendNum=" + resendNum +
                ", handleTime=" + handleTime +
                ", createTime=" + createTime +
                '}';
    }
}
